<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>地址栏</title>
    <script>
        function f1(){
            console.log(window.location);
            // 可以通过返回的Location对象中的href属性操作地址
            console.log("当前地址:"+location.href);
            // 可以通过重新赋值的方式改变当前地址栏的地址
            // 当地址栏的地址发生了改变,页面随之跳转
            location.href = "40-练习.html";
        }
        function f2(){
            // 获取当前当前窗口的窗口是谁
            console.log(window.opener.location);
            opener.location.href = "26-正则表达式.html";
        }
        function f3(){
            console.log(window.parent.location);
            parent.location.href = "37-事件冒泡.html";
        }
    </script>
</head>
<body>
<button onclick="f1()">获取当前地址栏</button><br>
<button onclick="f2()">获取打开当前窗口的窗口的地址栏</button><br>
<button onclick="f3()">获取父窗口的地址栏</button><br>
</body>
</html>